//
//  fugitiveVerticalViewController.m
//  fugitiveVertical
//
//  Created by Eugene Bistolas on 5/10/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "fugitiveVerticalViewController.h"

@implementation fugitiveVerticalViewController

- (void)dealloc
{
    [mapButton release];
    [networkButton release];
    [audioButton release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"APIs";
    
    //Set up buttons. 
    UIImage *normalImg = [[UIImage imageNamed:@"regular.png"] stretchableImageWithLeftCapWidth:12 topCapHeight:0];
    UIImage *highlightImg = [[UIImage imageNamed:@"hover.png"] stretchableImageWithLeftCapWidth:12 topCapHeight:0];
    UIImage *activeImg = [[UIImage imageNamed:@"active.png"] stretchableImageWithLeftCapWidth:12 topCapHeight:0];
    
    [mapButton setBackgroundImage:normalImg forState:UIControlStateNormal]; 
    [mapButton setBackgroundImage:highlightImg forState:UIControlStateHighlighted];
    [mapButton setBackgroundImage:activeImg forState:UIControlStateSelected];
    [networkButton setBackgroundImage:normalImg forState:UIControlStateNormal]; 
    [networkButton setBackgroundImage:highlightImg forState:UIControlStateHighlighted];
    [networkButton setBackgroundImage:activeImg forState:UIControlStateSelected];
    [audioButton setBackgroundImage:normalImg forState:UIControlStateNormal]; 
    [audioButton setBackgroundImage:highlightImg forState:UIControlStateHighlighted];
    [audioButton setBackgroundImage:activeImg forState:UIControlStateSelected];
    [[self navigationController] setNavigationBarHidden:YES animated:NO];    
}


- (void)viewDidUnload
{
    [mapButton release];
    mapButton = nil;
    [networkButton release];
    networkButton = nil;
    [audioButton release];
    audioButton = nil;
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (IBAction) buttonPressed:(UIButton *)sender {
    if (sender.tag == 1) {
        mapViewController *mapView = [[mapViewController alloc] initWithNibName:nil bundle:nil];
        [self.navigationController pushViewController:mapView animated:YES];
        [mapView release]; 
    }
    if (sender.tag == 2) {
        networkViewController *networkView = [[networkViewController alloc] initWithNibName:nil bundle:nil];
        [self.navigationController pushViewController:networkView animated:YES];
        [networkView release]; 
    }
    if (sender.tag == 3) {
        audioViewController *audioView = [[audioViewController alloc] initWithNibName:nil bundle:nil];
        [self.navigationController pushViewController:audioView animated:YES];
        [audioView release]; 
    }
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [[self navigationController] setNavigationBarHidden:NO animated:YES];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[self navigationController] setNavigationBarHidden:YES animated:YES];    
    
}

@end
